data<-read.csv("figure7.csv",header=T,as.is=T)

x <- lm(prop~defecting+congress, data=data, weights=n)
summary(x)


a<-summary(prediction(x, at = list(defecting = seq(0,1,.1))))

votes <- ggplot(data=a, aes(y=Prediction, x=`at(defecting)`)) +
	geom_line() +
	geom_ribbon(aes(ymin=lower,ymax=upper),alpha=0.3) +
	xlab("Proportion of Speeches on a Bill Engaging Bipartisanship\n(95% CIs, Congress Fixed Effects)") +
	ylab("Proportion of Members Defecting\nfrom Their Party on a Bill")+
	theme_pew()+ 
	theme(legend.position = "none") +
	ylim(0,1)
votes
ggsave("f7.pdf",votes,width=4, height=4)
